package cn.johnnyjian.getris.game.score

import static org.junit.Assert.assertEquals
import org.junit.Before
import org.junit.Test

class ScoreKeeperTest {

	def score

	@Before void setUp() {
		score = new ScoreKeeper()
	}

	@Test void testConstructor() {
		assertEquals 0, score.score
		assertEquals 0, score.lines
		assertEquals 1, score.level
	}

	@Test void testAddLines() {
		score.addLines 1
		assertEquals 1, score.lines
		assertEquals 10, score.score
		assertEquals 1, score.level

		score.addLines 2
		assertEquals 3, score.lines
		assertEquals 35, score.score
		assertEquals 1, score.level

		score.addLines 3
		assertEquals 6, score.lines
		assertEquals 80, score.score
		assertEquals 1, score.level

		score.addLines 4
		assertEquals 10, score.lines
		assertEquals 150, score.score
		assertEquals 2, score.level

		score.addLines 1
		assertEquals 11, score.lines
		assertEquals 170, score.score
		assertEquals 2, score.level

		score.addLines 4
		assertEquals 15, score.lines
		assertEquals 310, score.score
		assertEquals 2, score.level
	}

}
